package com.poulpicious.ethanj.states;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import com.poulpicious.ethanj.game.entities.Player;
import com.poulpicious.ethanj.util.GameData;

public class GameState extends BasicGameState {
	
	private Player player;
	
	@Override
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
		player = new Player(150, 150, 24, 36);
	}

	@Override
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
		g.drawString("Test", 10, 30);
		for (int x = 0; x < 800 / 32 + 1; x++) {
			for (int y = 0; y < 600 / 32 + 2; y++) {
				g.setColor(Color.white);
				g.drawRect(x * 32, y * 32, 32, 32);
			}
		}
		
		player.render(g);
	}

	@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		player.update(gc.getInput(), delta);
	}

	@Override
	public int getID() {
		return GameData.GAME;
	}
}
